import request from '@/utils/request'
import qs from 'qs'

export function initData(url, params) {
  return request({
    url: url + '?' + qs.stringify(params, {indices: false}),
    method: 'get'
  })
}

export function download(url, params) {
  return request({
    url: url + '?' + qs.stringify(params, {indices: false}),
    method: 'get',
    responseType: 'blob'
  })
}

export function upload(url, params) {
  return request({
    url: url,
    data: params,
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data;boundary=' + new Date().getTime()
    }
  })
}

export function externalRequest(url, data) {
  return request({
    url: url,
    data: data,
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    }
  })
}
